<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="security" %>

<style type="text/css">
<!--
.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	color: #707070;
	font-size: 12px;
}

.STYLE5 {
	color: #0a6e0c;
	font-size: 12px;
}

body {
	margin-top: 0px;
	margin-bottom: 0px;
}

.STYLE7 {
	font-size: 12
}
-->
</style>
<script type="text/javascript">
function checkForm() {
	var majorId = document.getElementById("majorId").value;
	var majorName = document.getElementById("majorName").value;
	var deptId = document.getElementById("deptId").value;
	
	if (majorId == 0) {
		alert("请输入专业编号！");
		return false;
	}
	if(majorName == 0){
		alert("请输入专业名称！");
		return false;
	}
	if(deptId == 0){
 		alert("请输入所属院系！");
 		return false;
		}
}
</script>

<html:form action="major.do?method=save" method="post" onsubmit="return checkForm();" >
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>&nbsp;</td>
					<td style="padding-right: 10px;">
					<div align="right"></div>
					</td>
				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="1"
				bgcolor="#c9c9c9">
				<tr>
					<td width="70%" height="22" bgcolor="#FFFFFF"><strong><span
						class="STYLE1">增加专业</span></strong></td>

			  </tr>
				<tr>
					<td bgcolor="#FFFFFF">
					<table width="700" border="0" align="center" cellpadding="0"
						cellspacing="0">
						<tr>
							<td width="193" align="right">专业编号：</td>
						  <td width="507"><html:text property="majorId" />
							<font color="red">${majorIdError }</font>
							<font color="red">${majorIdRequest }</font>							</td>
					  </tr>
						<tr>
							<td width="193" align="right">专业名称：</td>
						  <td width="507"><html:text property="majorName" />
							<font color="red">${majorNameError }</font>							</td>
					  </tr>
						
						<security:authorize ifAnyGranted="ROLE_DEPT_ADMIN">
						<tr>
							<td width="193" align="right">所属院系：</td>
						  <td width="507">
					  <html:select property="deptId">
								<html:option value="${dept.id}">${dept.deptName}</html:option>
							</html:select>
						<font color="red">${deptIdError }</font>							</td>
						</tr>
						</security:authorize>
						
						<security:authorize ifAnyGranted="ROLE_ADMIN">
						<tr>
							<td width="193" align="right">所属院系：</td>
						  <td width="507">
					  <html:select property="deptId">
								<html:option value="0">请选择</html:option>
							<c:if test="${!empty deptList}">
								<c:forEach items="${deptList}" var="dept">
								<html:option value="${dept.id}">${dept.deptName}</html:option>
								</c:forEach>
							</c:if>
							</html:select>
						<font color="red">${deptIdError }</font>							</td>
						</tr>
						</security:authorize>
						<tr>
							<td>&nbsp;</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="center">&nbsp;</td>
							<td><html:submit value="确认增加" /> &nbsp;&nbsp;&nbsp; <html:reset
								value="取 消" /></td>
						</tr>
					</table>					</td>
				</tr>
			</table>
		  </td>
		</tr>
		<tr>
			<td height="35">&nbsp;</td>
		</tr>
	</table>
</html:form>